import { createApp } from 'vue'
import App from './App.vue'
const app = createApp(App)


import router from './router'
app.use(router)

import store from './store'
app.use(store)

/*
    引用element
*/
// import ElementPlus from 'element-plus';
// import 'element-plus/lib/theme-chalk/index.css';
import installElementPlus from './plugins/element'
installElementPlus(app)
import axios from 'axios';
app.config.globalProperties.$axios = axios
const  SERVER_URL='http://103.45.150.118:5000'
// const  SERVER_URL='http://127.0.0.1:5000'
// const  SERVER_URL='http://106.12.129.184:5000'

app.config.globalProperties.GLOBAL = {url:SERVER_URL}
app.config.globalProperties.$请求 = function (地址, data, success, error) {
        var token=localStorage.getItem('token');
        data = JSON.parse( JSON.stringify(data))
        data.token = token
        axios
        .post(SERVER_URL+'/token' + 地址, data)
        .then((result)=>{
                console.log(result);
                if(result&&result.data.code==-100){
                        this.$XModal.message('无效过token',{status:'error'})
                        this.$router.push('/login'); //跳转到登录界面
                        return;
                }
                success(result)
        })
        .catch(error);
}
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
app.config.globalProperties.$XModal = VXETable.modal
app.use(VXETable)

import 'layui/dist/css/layui.css'
import 'layui/dist/layui'


app.mount('#app')

